package com.heima.wemedia.scan;

import com.heima.aliyun.AliyunGreenTemplate;
import com.heima.file.MinIOTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


import java.util.Arrays;
import java.util.Map;

@SpringBootTest
@RunWith(SpringRunner.class)
public class AliyunTemplateTest {

    @Autowired
    private AliyunGreenTemplate aliyunGreenTemplate;

    @Autowired
    private MinIOTemplate minIOTemplate;

    @Test
    public void testTextScan() {
        Map<String, String> result = aliyunGreenTemplate.greenTextScan("冰毒是毒品");
        System.out.println(result);
    }

    @Test
    public void testImageScan() {
        String url = "http://192.168.200.130:9000/leadnews/2022/04/15/8d4a6da8844f89e93.jpg";
        byte[] bytes = minIOTemplate.downLoadFile(url);

        Map<String, String> result = aliyunGreenTemplate.greenImageScan(Arrays.asList(bytes));
        System.out.println(result);
    }
}